$(function () {   
    $(".tableBtn").click(function () {   
        //用户名验证    
        let userName = document.querySelector("input[name='userName']");
        if (!/[a-zA-Z0-9]{1,10}@[a-zA-Z0-9]{1,5}\.[a-zA-Z0-9]{1,5}|^1[3578]\d{9}$|^[\u4e00-\u9fa5]{2,4}$/.test(userName.value)) {
            userName.setCustomValidity("要符合用户名的格式");
        } else {         
            userName.setCustomValidity("");                
        }
        //密码验证
        let password = document.querySelector("input[name='password']");
        if (!/\w{6,10}/.test(password.value)) {
            password.setCustomValidity("密码应为6~10位的字符");
        } else {
            password.setCustomValidity("") ;             
        }        
    })   
});